package org.nlp2rdf.navigator.client.common;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

import org.nlp2rdf.navigator.client.util.ConceptDTOHelper;

@SuppressWarnings("serial")
public class ConceptDTO extends DTO {

	protected String kbSyntaxString;
	protected String manchesterSyntaxString;
	protected Set<String> namedConceptsAndProperties = new HashSet<String>();

	protected String base = "";
	protected Map<String, String> prefixToNamespace = new HashMap<String, String>();
	protected Map<String, String> namespaceToPrefix = new HashMap<String, String>();

	protected String label;
	protected String comment;

	/**
	 * Use is discouraged and only for beans and serializers use other
	 * constructor
	 */
	@Deprecated
	public ConceptDTO() {
		super();
	}

	public ConceptDTO(String kbSyntaxString, String manchesterSyntaxString) {
		super();
		this.kbSyntaxString = kbSyntaxString;
		setManchesterSyntaxString(manchesterSyntaxString);
	}

	public void setManchesterSyntaxString(String manchesterSyntaxString) {
		this.manchesterSyntaxString = manchesterSyntaxString.trim();
		this.namedConceptsAndProperties = ConceptDTOHelper.extractNamedConceptsAndProperties(this);
	}

	public void setKbSyntaxString(String kbSyntaxString) {
		this.kbSyntaxString = kbSyntaxString.trim();
	}

	@Override
	public String toString() {
		return getLabel() + " equals [" + ConceptDTOHelper.getMOSNoHTML(this) + "]";
	}

	public String toDebugString() {
		StringBuffer ret = new StringBuffer();
		ret.append("MOS: " + getManchesterSyntaxString() + "\n");
		ret.append("Named: " + getNamedConceptsAndProperties() + "\n");
		ret.append("KB: " + getKbSyntaxString() + "\n");
		ret.append("Label: " + getLabel() + " ");
		ret.append("Comment: " + getComment() + " ");
		return ret.toString();
	}

	public String getLabelNotNull() {
		return (label == null) ? "No label available. " : label;

	}
	public String getCommentNotNull() {
		return (comment == null) ? "No comment available. " : comment;
		
	}

	/** GETTERS AND SETTER BELOW **/

	public String getKbSyntaxString() {
		return kbSyntaxString;
	}

	public Set<String> getNamedConceptsAndProperties() {
		return namedConceptsAndProperties;
	}

	public void setNamedConceptsAndProperties(Set<String> namedConcepts) {
		this.namedConceptsAndProperties = namedConcepts;
	}

	public Map<String, String> getPrefixToNamespace() {
		return prefixToNamespace;
	}

	public void setPrefixToNamespace(Map<String, String> prefixToNamespace) {
		this.prefixToNamespace = prefixToNamespace;
	}

	public Map<String, String> getNamespaceToPrefix() {
		return namespaceToPrefix;
	}

	public void setNamespaceToPrefix(Map<String, String> namespaceToPrefix) {
		this.namespaceToPrefix = namespaceToPrefix;
	}

	public String getBase() {
		return base;
	}

	public void setBase(String base) {
		this.base = base;
	}

	public String getLabel() {
		return label;
	}

	public void setLabel(String label) {
		this.label = label;
	}

	public String getComment() {
		return comment;
	}

	public void setComment(String comment) {
		this.comment = comment;
	}

	public String getManchesterSyntaxString() {
		return manchesterSyntaxString;
	}

}
